package com.aaa.book_mall.controller;

import com.aaa.book_mall.dao.OutDao;
import com.aaa.book_mall.dao.RecordDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import sun.net.util.IPAddressUtil;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @Description: 数据分析controller
 * @ClassName: DataAnalController
 * @Author: fengyun
 * @Date: 2021/2/25 15:17
 * @Version: 1.0
 */
@RestController
@RequestMapping("/dataAnal")
public class DataAnalController {
    @Autowired
    private RecordDao recordDaoImpl;

    @Autowired
    private OutDao outDaoImpl;

    @RequestMapping("/outAndInMoney")
    public HashMap<String, Object> outAndInMoney(String scopDate){
        System.out.println("/outAndInMoney");
        if("".equals(scopDate) || scopDate==null){
            System.out.println(scopDate);
        }else {
            System.out.println("scopDate"+scopDate);
        }
        List<List> listsOut = outDaoImpl.selectOutMoney(scopDate);//出库每月总金额
        List<List> listsIn = recordDaoImpl.selectInMoney(scopDate);//入库每月总金额
        HashMap<String, Object> map = new HashMap<>();
        map.put("outMoney",listsOut);
        map.put("inMoney",listsIn);
        return map;
    }

}
